<!doctype html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>企业后台管理</title>
    <#include "head.ftl">
</head>
<body class="login-bg">

<div class="login layui-anim layui-anim-up">
    <div class="message">登录</div>
    <div id="darkbannerwrap"></div>

    <form id="logForm" method="post" class="layui-form">
        <input name="userName" placeholder="用户名" type="text" lay-verify="required" class="layui-input">
        <hr class="hr15">
        <input name="password" lay-verify="required" placeholder="密码" type="password" class="layui-input">
        <hr class="hr15">
        <input value="登录" lay-submit lay-filter="login" style="width:100%;" type="submit">
        <hr class="hr20">
    </form>
</div>

<script>
    $(function () {
        layui.use('form', function () {
            var form = layui.form;
            form.on('submit(login)', function (data) {
                var param = $("#logForm").serializeArray();
                $.post("${basePath}/logValidate", param, function (rs) {
                    var obj = eval('(' + rs + ')');
                    if (obj.status == 200) {
                        layer.msg("登陆成功", function () {
                            location.href = '${basePath}/index'
                        });
                    } else {
                        layer.alert("用户名密码错误！");
                    }
                })

                return false;
            });
        });
    })
</script>
</body>
</html>